package com.chia.multienty.core.controller;


import com.chia.multienty.core.domain.condition.WechatCondition;
import org.springframework.context.annotation.Conditional;
import org.springframework.web.bind.annotation.RequestMapping;
import com.chia.multienty.core.service.WechatMppSceneService;
import com.chia.multienty.core.domain.dto.WechatMppSceneDTO;
import com.chia.multienty.core.pojo.WechatMppScene;
import com.chia.multienty.core.parameter.wechat.WechatMppSceneDetailGetParameter;
import com.chia.multienty.core.parameter.wechat.WechatMppScenePageGetParameter;
import com.chia.multienty.core.parameter.wechat.WechatMppSceneDeleteParameter;
import com.chia.multienty.core.parameter.wechat.WechatMppSceneSaveParameter;
import com.chia.multienty.core.parameter.wechat.WechatMppSceneUpdateParameter;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.chia.multienty.core.annotation.WebLog;
import com.chia.multienty.core.domain.basic.Result;
import org.springframework.web.bind.annotation.RestController;
import lombok.RequiredArgsConstructor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
 * <p>
 * 微信小程序场景 服务
 * </p>
 *
 * @author Multienty Auto Generator
 * @since 2024-06-26
 */
@RestController
@Validated
@RequestMapping("/wechat-mpp-scene")
@RequiredArgsConstructor
@Api(tags = "微信小程序场景")
@Conditional(WechatCondition.class)
public class WechatMppSceneController {

    private final WechatMppSceneService wechatMppSceneService;

    @PostMapping("/detail")
    @ApiOperation("获取微信小程序场景详情")
    public Result<WechatMppSceneDTO> getDetail(@Validated @RequestBody WechatMppSceneDetailGetParameter parameter) {
        WechatMppSceneDTO detail = wechatMppSceneService.getDetail(parameter);
        return new Result<>(detail);
    }

    @PostMapping("/page")
    @ApiOperation("获取微信小程序场景分页列表")
    public Result<IPage<WechatMppSceneDTO>> getPage(@Validated @RequestBody WechatMppScenePageGetParameter parameter) {
        IPage<WechatMppSceneDTO> page = wechatMppSceneService.getPage(parameter);
        return new Result<>(page);
    }

    @PostMapping("/update")
    @ApiOperation("更新微信小程序场景")
    @WebLog(target = "WechatMppScene")
    public Result<Boolean> update(@Validated @RequestBody WechatMppSceneUpdateParameter parameter) {
        wechatMppSceneService.update(parameter);
        return new Result<>(true);
    }

    @PostMapping("/save")
    @ApiOperation("保存微信小程序场景")
    @WebLog(target = "WechatMppScene")
    public Result<Boolean> save(@Validated @RequestBody WechatMppSceneSaveParameter parameter) {
        wechatMppSceneService.save(parameter);
        return new Result<>(true);
    }


    @DeleteMapping("/delete")
    @ApiOperation("删除微信小程序场景")
    @WebLog(target = "WechatMppScene")
    public Result<Boolean> delete(@Validated @RequestBody WechatMppSceneDeleteParameter parameter) {
        wechatMppSceneService.delete(parameter);
        return new Result<>(true);
    }

}
